﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using UCL.Powersource;

namespace UCL.Powersource.Mock
{
    [DataContract(IsReference=true)]
    public class DummyTeamProjectConfiguration : ITfsTeamProjectConfiguration
    {

        public DummyTeamProjectConfiguration(string name, int id, ITfsTeamProjectCollectionConfiguration coll)
            : this(name,id,coll,Guid.NewGuid())
        {
        }
        public DummyTeamProjectConfiguration(string name, int id, ITfsTeamProjectCollectionConfiguration coll, Guid guid)
        {
            UniqueName = name;
            UniqueId = id;
            UniqueGuid = guid;
            TeamProjectCollectionConfiguration = coll;
            _ProjectAnalysisBridge = new DummyAnalysisBridge(this);
        }

        [DataMember]
        public string UniqueName { get; private set; }
        [DataMember]
        public int UniqueId { get; private set; }
        [DataMember]
        public bool IsChosen { get; set; }
        [IgnoreDataMember]
        public bool IsValidForStatistic
        {
            get { return IsChosen; }
        }

        [DataMember]
        public string SolutionFilePath { get; set; }

        public IEnumerable<ITimeFrame> ProjectTimeframes
        {
            get { return TeamProjectCollectionConfiguration.ProjectCollectionTimeFrames; }
        }

        public ITfsTeamProjectCollectionConfiguration TeamProjectCollectionConfiguration { get; private set; }
            [DataMember]
    
        private DummyAnalysisBridge _ProjectAnalysisBridge;
        public IAnalysisBridge ProjectAnalysisBridge
        {
            get { return _ProjectAnalysisBridge; }
        }

        public string Label
        {
            get { return UniqueName; }
        }


        public string Uri
        {
            get { return TeamProjectCollectionConfiguration.Uri + "/" + UniqueName; }
        }

        [DataMember]
        public Guid UniqueGuid
        {
            get;
            private set;
        }

        private string[] _MemberNames = {"Member1", "Member2"};
        public IReadOnlyList<string> MemberNames
        {
            get { return _MemberNames; }
        }

        public void Synchronize()
        {
            
        }


        public string MemberNamesString
        {
            get { return "Member1, Member2"; }
        }
    }
}
